#!/bin/bash

app_file=`rpm -ql patch-tracking | grep app.py`
app_path=${app_file%/app.py}
chdir_path=${app_file%/patch_tracking/app.py}

settings_file='/etc/patch-tracking/settings.conf'

server=`grep 'LISTEN' $settings_file | awk -F'=' '{print $2}' | sed -e 's/^[ ]"*//g' -e "s/^'*//g" | sed -e 's/"*$//g' -e "s/'*$//g" | sed -e 's/^[ \t]*//g' | sed -e 's/[ \t]*$//g'`
uwsgi --master --https "${server},/etc/patch-tracking/self-signed.crt,/etc/patch-tracking/self-signed.key" --wsgi-file "${app_file}" --callable app --chdir "${chdir_path}" --threads 100 --lazy
